#pragma once
#include <Blobz.h>
#include "Graphics/PDF/PDF.h"

namespace Tutorial4
{
	// A basic PDF file manager class. Loads the specified pdf and also provides methods for changing and displaying pages
	class TutPDF : public Blobz::Interactable
	{
	public:
		TutPDF();
		~TutPDF();

	public:
		bool load(const QString& inApplicationDirectory,const QString& inFilePath);
		void unload();

		void onUpdate(float inFrameTime);
		void onRender();

		void onFingerDown(const TouchListener::TouchData& inData);
		void onFingerUp(const TouchListener::TouchData& inData);
		void onFingerUpdate(const TouchListener::TouchData& inData);

	public:
		void onPageCached(int inPageNr, const QString& inPagePath);
		void previousPage();
		void nextPage();
		void reset();

	private:
		Blobz::PDF mPDF;
		int mTotalNumberOfPages;
		int mCurrentPageNumber;
		Blobz::Sprite mPage;
		QMap<int, QString> mPages;
		QVector2D mPageSize;
		Blobz::Texture mLoadingTexture;
		bool mFetchSize;
	};
}
